home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 57805 / 57805.xpi / content / options.js < prev    next >
Text File  |  2010-01-25  |  4KB  |  82 lines

  1. /* 
  2.         #################################################################
  3.         #   Firefox GUI Minify                                          #
  4.         #################################################################
  5.         #   Author:     Domenico Martella                               #
  6.         #   E-mail:     domenico.martella@alcacoop.it                   #
  7.         #   Date:       2010-01-04                                      #
  8.         #################################################################
  9.         #                                                               #
  10.         #       Copyright (C) 2010  - Alca Soc. Coop. (Lecce, IT)       #
  11.         #       http://www.alcacoop.it                                  #
  12.         #                                                               #
  13.         # This program is free software; you can redistribute           #
  14.         # it and/or modify it under the terms of the GNU General        #
  15.         # Public License as published by the Free Software              #
  16.         # Foundation; either version 3 of the License, or (at your      #
  17.         # option) any later version.                                    #
  18.         #                                                               #
  19.         # This program is distributed in the hope that it will be       #
  20.         # useful, but WITHOUT ANY WARRANTY; without even the            #
  21.         # implied warranty of MERCHANTABILITY or FITNESS FOR A          #
  22.         # PARTICULAR PURPOSE.  See the GNU General Public License       #
  23.         # for more details.                                             #
  24.         #                                                               #
  25.         # You should have received a copy of the GNU General            #
  26.         # Public License along with this program; if not, write to      #
  27.         # the Free Software Foundation, Inc., 59 Temple Place -         #
  28.         # Suite 330, Boston, MA  02111-1307, USA.                       #
  29.         #################################################################
  30. */ 
  31.  
  32. window.addEventListener("load", function(ev){
  33.   document.getElementById("title").value = "" + "Hide GUI Bars v"+
  34.   Application.extensions.get("gui_minify@alcacoop.it").version;
  35. }, false);
  36.  
  37. var changeKey = function(ev){
  38.  
  39.   ev.preventDefault();
  40.   ev.stopPropagation();
  41.  
  42.   var strbundle = document.getElementById("strings");
  43.   var btnstr1=strbundle.getString("btnstr1");
  44.   var valstr2=strbundle.getString("valstr2");
  45.   var valstr3=strbundle.getString("valstr3");
  46.  
  47.   switch (KeyUtils.isAllowed(ev)){
  48.     case -3: //NO MODIFIERS
  49.       return;
  50.     case -2: //NO MODIFIERS
  51.       document.getElementById("hgb-all-validate").value=valstr2;
  52.       return;
  53.     case -1: //ONLY ALPHANUMERIC
  54.       document.getElementById("hgb-all-validate").value=valstr3;
  55.       return;
  56.   }
  57.  
  58.   var sc = KeyUtils.keyev2string(ev);
  59.   Application.prefs.setValue("gui_minify.allshortcut", sc);
  60.  
  61.   document.getElementById("grab_key").label=btnstr1;
  62.   document.getElementById("hgb-all-validate").value="";
  63.   document.getElementById("txt_keycode").value=sc;
  64.   window.removeEventListener("keyup", changeKey, true);
  65. }
  66.  
  67.  
  68. var grabKey = function(){
  69.   var strbundle = document.getElementById("strings");
  70.   var btnstr2=strbundle.getString("btnstr2");
  71.   var valstr1=strbundle.getString("valstr1");
  72.  
  73.  
  74.   document.getElementById("txt_keycode").value="";
  75.   document.getElementById("hgb-all-validate").value=valstr1;
  76.   document.getElementById("grab_key").label=btnstr2;
  77.   document.getElementById("grab_key").blur();
  78.   document.getElementById("txt_keycode").focus();
  79.   window.addEventListener("keyup", changeKey, true);
  80. }
  81.  
  82.